Fix a problem with auto save file names.
authorRob Browning <rlb@defaultvalue.org>
Sun, 2 Mar 2008 20:47:01 +0000 (12:47 -0800)
committerRob Browning <rlb@defaultvalue.org>
Sun, 2 Mar 2008 20:47:01 +0000 (12:47 -0800)
debian/changelog
debian/patches/fix-auto-save-file-name.diff [new file with mode: 0644]
debian/patches/series

index 5e8faf9c3fe43b9110d9a0fa6d407e752a828cc6..209c604da62a497b378452a9f27ab0bec9ed98c8 100644 (file)
@@ -18,7 +18,10 @@ emacs22 (22.1+1-3) unstable; urgency=low
 
   * Don't override install-info anymore. (closes: #438695)
 
- -- Rob Browning <rlb@defaultvalue.org>  Sun, 02 Mar 2008 10:55:51 -0800
+  * Fix a problem with auto save file names.  Thanks to Sven Joachim
+    <svenjoac@gmx.de>. (closes: #469017)
+
+ -- Rob Browning <rlb@defaultvalue.org>  Sun, 02 Mar 2008 12:44:58 -0800
 
 emacs22 (22.1+1-2) unstable; urgency=low
 
diff --git a/debian/patches/fix-auto-save-file-name.diff b/debian/patches/fix-auto-save-file-name.diff
new file mode 100644 (file)
index 0000000..0d20b6d
--- /dev/null
@@ -0,0 +1,44 @@
+* A problem with auto save file name encoding has been fixed.
+  Patch: fix-auto-save-file-name.diff
+  Provided-by: Sven Joachim <svenjoac@gmx.de>
+  Date: Sun, 02 Mar 2008 18:41:33 +0200
+  Added-by: Rob Browning <rlb@defaultvalue.org>
+  Status: merged upstream
+
+  Upstream changelog entry:
+
+  2008-02-26  Jason Rumney  <jasonr@gnu.org>
+
+        * files.el (make-auto-save-file-name): Encode more characters in
+        non-file buffer names.  Use url-encoding.
+
+Index: sid/lisp/files.el
+===================================================================
+--- sid.orig/lisp/files.el
++++ sid/lisp/files.el
+@@ -4510,15 +4510,18 @@
+     (let ((buffer-name (buffer-name))
+         (limit 0)
+         file-name)
+-      ;; Eliminate all slashes and backslashes by
+-      ;; replacing them with sequences that start with %.
+-      ;; Quote % also, to keep distinct names distinct.
+-      (while (string-match "[/\\%]" buffer-name limit)
++      ;; Restrict the characters used in the file name to those which
++      ;; are known to be safe on all filesystems, url-encoding the
++      ;; rest.
++      ;; We do this on all platforms, because even if we are not
++      ;; running on DOS/Windows, the current directory may be on a
++      ;; mounted VFAT filesystem, such as a USB memory stick.
++      (while (string-match "[^A-Za-z0-9-_.~#+]" buffer-name limit)
+       (let* ((character (aref buffer-name (match-beginning 0)))
+              (replacement
+-              (cond ((eq character ?%) "%%")
+-                    ((eq character ?/) "%+")
+-                    ((eq character ?\\) "%-"))))
++                ;; For multibyte characters, this will produce more than
++                ;; 2 hex digits, so is not true URL encoding.
++                (format "%%%02X" character)))
+         (setq buffer-name (replace-match replacement t t buffer-name))
+         (setq limit (1+ (match-end 0)))))
+       ;; Generate the file name.
index f7397b26a27f665e3a91ef057ac7921f00e1334f..76cf134e4b6ddd6030ce7739231e2404a93a5f3f 100644 (file)
@@ -13,4 +13,5 @@ avoid-fakemail-mail-loss.diff
 version-mention-debian.diff
 support-gnu-kfreebsd.diff
 fix-format-overflow-cve-2007-6109.diff
+fix-auto-save-file-name.diff
 autofiles.diff